import aima.core.agent.Action;

public class PacmanAction implements Action {

	private final Direction direction;

	public PacmanAction(final Direction direction) {
		this.direction = direction;
	}

	public Point giveNewPacmanLocation(final Point oldPacmanLocation) {
		return direction.translate(oldPacmanLocation);
	}

	@Override
	public boolean isNoOp() {
		return false;
	}

	@Override
	public int hashCode() {
		return direction.hashCode();
	}

	@Override
	public boolean equals(Object other) {
		if (other instanceof PacmanAction) {
			final PacmanAction action = (PacmanAction) other;
			return direction.equals(action.direction);
		}
		return false;
	}

	@Override
	public String toString() {
		return String.format("Move %s", direction);
	}

}
